package reading.web.controllers;

import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import reading.util.utils.IpUtil;

import javax.servlet.http.HttpServletRequest;

/**
 * ${DESCRIPTION}
 *
 * @author txw
 * @since 2019-02-15 16:49
 **/
@Controller
public class Mp3Controller {
    @RequestMapping("/download/{id}")
    @ApiOperation("mp3 下载")
    public ModelAndView download(@PathVariable Long id, HttpServletRequest request){
        ModelAndView modelAndView = new ModelAndView("index");
        System.out.println(request.getRequestURI());
        modelAndView.addObject("id",id);
        modelAndView.addObject("basePath",
                request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort());
        return modelAndView;
    }

}
